<div class="layui-body">

	<div class="aright">
	<span class="layui-breadcrumb">
	  <a href="{:url('man/index/index')}">首页</a>
	  {if condition="$map['nceng'] eq 1"}
	  <a href="{:url('man/article/index')}">题目管理</a>
	  {else /}
	  <a href="{:url('man/article/index')}">题目管理</a>
	   <a href="{:url('man/article/item',['nid'=>$map['nnid'],'nceng'=>1])}">一级选项</a>
	  {/if}
	  <a><cite>选项列表</cite></a>
	</span>
	<div class="arz cl">{eq name="$map.nceng" value="1"}<a href="{:url('man/article/additem',['nid'=>$map['nid'],'nceng'=>$map['nceng']])}">{else /}<a href="{:url('man/article/additem',['nid'=>$map['nid'],'nnid'=>$map['nnid'],'nceng'=>$map['nceng']])}">{/eq}<i class="layui-icon">&#xe608;</i>添加选项</a>      <a href="{:url('man/article/relationitem',['nid'=>$map['nid']])}"><i class="layui-icon">&#xe608;</i>选项关联</a></div>
	<form method="post" class="aform cl" >
	<table width="100%">
	      <tr>

			<th width="5%" align="center">ID编号</th>
	        <th width="25%" align="center">问题标题</th>
			<th width="10%" align="center">缩略图</th>
			<th width="9%" align="center">排序</th>
			{eq name="$map.nceng" value="2"}
			<th width="9%" align="center">分值</th>
			{/eq}
	        <th width="18%" align="center">基本操作</th>
	      </tr>
	      {volist name="item" id="vo"}
		  <tr>
			<td align="center">{$vo.id}</td>
	        <td align="center">{$vo.iname|msubstr=0,30,'utf8',false}</a></td>
			<td align="center">
			{if condition="$vo['iimage'] neq ''"}
	        <img src="http://static-resource.ufile.ucloud.com.cn/{$vo.iimage}" height="30">
	        {else /}
	        暂无缩略图
	        {/if}
			</td>
			<td align="center"><input type="hidden" name="nid" value="{$vo.id}"><input type="text"  class="layui-input shunxu" value="{$vo.ishunxu}" /></td>
			{eq name="$map.nceng" value="2"}
			<td align="center"><input type="hidden" name="nid" value="{$vo.id}"><input type="text"  class="layui-input zhi" value="{$vo.nzhi}" /></td>
			{/eq}
	        <td align="center"><a href="{:url('man/article/edititem',['id'=>$vo['id'],'nid'=>$map['nid'],'nceng'=>$map['nceng']])}">【编 辑】</a> | {if condition="$vo.nceng eq 1"}<a href="{:url('man/article/item',['nid'=>$vo['id'],'nceng'=>2,'nnid'=>$map['nid']])}">【选 项】</a> |{/if} <a onclick="deleted({$vo.id});">删除</a>
	        </td>
	      </tr>
	      {/volist}
	 </table>

	  </form>
	 		<div class="pages">
 				 
	 	 	</div>
	</div>
	</div>
</div>
<script>
layui.use('layer',function(){
	var layer = layui.layer;
})
$(function(){
	$(".shunxu").change(function(){
		var nid=$(this).parent().find("input[name='nid']").val();
		var nextnum=$(this).val();

		$.post("{:url('man/article/ajaxparam')}",{'nid':nid,'num':nextnum,'field':'ishunxu'},function(data){
			if(data){
				layer.msg("修改成功");
			}
		});
	});
	$(".zhi").change(function(){
		var nid=$(this).parent().find("input[name='nid']").val();
		var nextnum=$(this).val();

		$.post("{:url('man/article/ajaxparam')}",{'nid':nid,'num':nextnum,'field':'nzhi'},function(data){
			if(data){
				layer.msg("修改成功");
			}
		});
	});
})
function deleted(aid){
	$.post("{:url('man/article/delete')}",{'aid':aid,'type':2},function(data){
		if(data){
			layer.msg("删除成功");
			setTimeout(function(){
				window.location.reload();
			},1000);
			
		}
	})
}
</script>